﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LPY.LeHealth.DAL;
using LPY.LeHealth.Model;

namespace LPY.LeHealth.Service
{
    using AutoMapper;
    using AutoMapper.Execution;
    using AutoMapper.Configuration;
    using AutoMapper.Mappers;
    using LPY.LeHealth.DTO;
    public class HospitalAdminService
    {
        HospitalAdminDal dal = new HospitalAdminDal();
         /// <summary>
        /// 医院管理员登陆
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public HospitalAdmin AdminLogin(string name, string pwd)
        {
            return dal.Get(name,pwd);
        }

         /// <summary>
        /// 获取医院管理员信息
        /// </summary>
        /// <returns></returns>
        public List<HospitalAdmin> GetHospitalAdmin(int HospitalId)
        {
            var hosadmin = dal.GetHospitalAdmin(HospitalId);

            return hosadmin;
        }
        public List<HospitalAdmin> GetHospitalAdmin()
        {
            var hosadmin = dal.GetHospitalAdmin();

            return hosadmin;
        }
        /// <summary>
        /// 添加医院管理员
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public bool Adduser(int id,string name,string pwd)
        {
            var Hos = new HospitalAdmin();
            Hos.HospitalId = id;
            Hos.Uname = name;
            Hos.Pwd = pwd;
            return dal.Adduser(Hos);
        }
        /// <summary>
        /// 根据ID删除医院管理员
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteUser(int id)
        {
            return dal.DeleteUser(id);
        }
        /// <summary>
        /// 显示体检人员信息
        /// </summary>
        /// <returns></returns>
        public List<LPY.LeHealth.Model.PhysicalPeople1> SelectOrder(int HospitalId)
        {
            return dal.SelectOrder(HospitalId);
        }
        /// <summary>
        /// 根据订单时间和单据号查询体检人员信息
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="strtime1"></param>
        /// <param name="strtime2"></param>
        /// <returns></returns>
        public List<LPY.LeHealth.Model.PhysicalPeople1> Selectorder(string OrderId, string strtime1, string strtime2,int Hospitalid)
        {
            return dal.Selectorder(OrderId, strtime1, strtime2, Hospitalid);
        }
        /// <summary>
        /// 根据订单时间查询体检信息 
        /// </summary>
        /// <param name="strtime1"></param>
        /// <param name="strtime2"></param>
        /// <returns></returns>
        public List<LPY.LeHealth.Model.PhysicalPeople1> Selectorder(string strtime1, string strtime2,int Hospitalid)
        {
            return dal.Selectorder(strtime1, strtime2, Hospitalid);
        }
        /// <summary>
        /// 根据订单号查询订单信息
        /// </summary>
        /// <param name="OrderId"></param>
        /// <returns></returns>
        public List<OrderDcom> ShowOrder(string OrderId)
        {
            return dal.ShowOrder(OrderId);
        }
        /// <summary>
        /// 根据订单号删除体检信息 
        /// </summary>
        /// <param name="orderid"></param>
        /// <returns></returns>
        public int DelDetail(int? orderid)
        {
            return dal.DelDetail(orderid);
        }
        /// <summary>
        /// 获取订单状态
        /// </summary>
        /// <returns></returns>
        public List<Order> ShowOrderState()
        {
            return dal.ShowOrderState();
        }
        /// <summary>
        /// 根据订单编号,获取订单状态
        /// </summary>
        /// <param name="OrderId"></param>
        /// <returns></returns>
        public Order ShowOrderState(string OrderId)
        {
            return dal.ShowOrderState(OrderId);
        }
        /// <summary>
        /// 根据订单编号,修改订单状态
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool UpdateState(string OrderId,int state)
        {
            return dal.UpdateState(OrderId, state);
        }
        public int SelectUserid(string username,int hotpitalid)
        {
            return dal.SelectUserid(username, hotpitalid);
        }
        /// <summary>
        /// 根据订单状态和日期获取订单信息
        /// </summary>
        /// <param name="StateId"></param>
        /// <param name="strtime1"></param>
        /// <param name="strtime2"></param>
        /// <returns></returns>
        public List<PhysicalPeople1>SelectState(int?StateId,string strtime1,string strtime2,int HospitalId)
        {
            return dal.SelectState(StateId, strtime1, strtime2, HospitalId);
        }
        /// <summary>
        /// 根据订单状态获取订单信息
        /// </summary>
        /// <param name="StateId"></param>
        /// <returns></returns>
        public List<PhysicalPeople1>SelectStateId(int?StateId,int HospitalId)
        {
            return dal.SelectStateId(StateId,HospitalId);
        }
        /// <summary>
        /// 获取套餐信息
        /// </summary>
        /// <returns></returns>
        public List<OrderDcom>SelectDcom(int HospitalId)
        {
            return dal.SelectDcom(HospitalId);
        }

         /// <summary>
        /// 根据套餐ID显示订单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<PhysicalPeople1>SelectComboId(int?id,int HospitalId)
        {
            return dal.SelectComboId(id,HospitalId);
        }

         /// <summary>
        /// 批量审批订单状态
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool PupdateState(string OrderId,int state)
        {
            return dal.PupdateState(OrderId, state);
        }
        public List<StateDemo>SelectState()
        {
            return dal.SelectState();
        }
    }
}
